﻿@model ChangePasswordIM
@{
    ViewBag.Title = "修改密码";
}


<div class="container">
    <div class="row">
        <aside class="col-sm-3">
            @Html.Partial("_AccountNav")
        </aside>
        <section class="col-sm-9">


            @using (Ajax.BeginForm("UpdatePWD", null, new AjaxOptions
            {

                HttpMethod = "POST",
                OnBegin = "onBeginSave",
                OnComplete = "onCompleteSave",
                OnSuccess = "updateSuccess"

            }, new { role = "form", @class = "form-horizontal" }))
            {
                @Html.AntiForgeryToken()
                @Html.ValidationSummary(true)

                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h3 class="panel-title">修改密码</h3>
                    </div>
                    <div class="panel-body">
                        <div class="form-group">
                            @Html.LabelFor(u => u.OldPassword, new { @class = "col-xs-4 control-label" })
                            <div class="col-xs-8">
                                @Html.PasswordFor(m => m.OldPassword, new { @class = "form-control", placeholder = Labels.OldPassword })
                                @Html.ValidationMessageFor(model => model.OldPassword)
                            </div>
                        </div>

                        <div class="form-group">
                            @Html.LabelFor(u => u.NewPassword, new { @class = "col-xs-4 control-label" })
                            <div class="col-xs-8">
                                @Html.PasswordFor(m => m.NewPassword, new { @class = "form-control", placeholder = Labels.NewPassword })
                                @Html.ValidationMessageFor(model => model.NewPassword)
                            </div>
                        </div>

                        <div class="form-group">
                            @Html.LabelFor(u => u.ConfirmPassword, new { @class = "col-xs-4 control-label" })
                            <div class="col-xs-8">
                                @Html.PasswordFor(m => m.ConfirmPassword, new { @class = "form-control", placeholder = Labels.ConfirmPassword })
                                @Html.ValidationMessageFor(model => model.ConfirmPassword)
                            </div>
                        </div>
                        
                    </div>
                    <div class="panel-footer text-center">

                        <button class="btn btn-primary" type="submit" id="btnSave"><i class="fa fa-save fa-fw"></i>保存</button>
                        <button type="reset" class="btn btn-default">重设</button>
                    </div>
                </div>

            }

        </section>

    </div>
</div>

@section Footer {
    @Scripts.Render("~/bundles/jqueryvalWithBootstrap")
    <script>
        
    function onBeginSave() {
        $("#btnSave i").removeClass("fa-save").addClass("fa-spinner fa-spin");
    }
    function onCompleteSave() {
        $("#btnSave i").removeClass("fa-spinner fa-spin").addClass("fa-save");
    }

    function updateSuccess(data) {
        var title = '@ViewBag.Title';
        Common.ShowBox(data.Status, data.Message, title);
    }

        $(function () {

        })
    </script>
}